<template>
  <span>
    <el-button type="primary" round @click="showPicker">选择人员/部门</el-button>
    <org-items v-model="modelValue.compareVal"/>
    <org-picker ref="orgPicker" :multiple="modelValue.compare === 'IN'"
                title="选择要比较的人员/部门" :selected="modelValue.compareVal" @ok="selected"/>
  </span>
</template>

<script>
import OrgPicker from "/@/views/setting/workflow/process/OrgPicker.vue";
import OrgItems from "/@/views/setting/workflow/process/OrgItems.vue";
import { reactive, ref, toRefs } from 'vue';
export default {
  name: "OrgCompare",
  components: {OrgItems, OrgPicker},
  props: {
    modelValue:{
      require: true,
      type: Object
    },
    context: {
      require: true,
      type: Object
    }
  },
  setup(props) {
    const { context } = toRefs(props)
    const orgPicker = ref()
    const showPicker = () => {
        orgPicker.value.show()
    }
    const selected = (orgs) => {
      context.value.compareVal = orgs
    }
    return {
        orgPicker,
        showPicker,
        selected
    }
  } 
}
</script>

<style>

</style>